import { action, makeObservable, observable } from "mobx"

export default class CounterStore {
  constructor() {
    this.count = 0
    // 设置store
    makeObservable(this, {
      count: observable,
      increment: action.bound, // bound是用于绑定this为当前文件的作用域
      decrement: action.bound
    })
  }

  increment() {
    this.count += 1
  }

  decrement() {
    this.count -= 1
  }
}

